<template>
  <div class="container">
    <div class="top-title">
      <div class="time">{{ date }}</div>
      <div class="user" @click="$router.push('/myIndex')"><img src="../../../../assets/img/icon-user.png" alt=""></div>
    </div>
    <calendar :editor="false" @getCourse="getCourse"/>
    <van-dialog
      v-model="showCourse"
      :show-confirm-button="false">
      <van-field v-model="course.name" label="课程名称" disabled/>
      <van-field v-model="course.teacher" label="教师姓名" disabled/>
      <van-field v-model="course.time" label="上课时间" disabled/>
      <div class="bottom-btns">
        <div class="bottom-btn">
          <button>分享报告</button>
        </div>
        <div class="bottom-btn">
          <button>分享海报</button>
        </div>
        <div class="bottom-btn">
          <button>请假</button>
        </div>
      </div>
      <div class="close" slot="title" @click="showCourse = false">X</div>
    </van-dialog>
  </div>
</template>

<script>
import calendar from '@/components/calendar'
export default {
  name: 'index',
  data () {
    return {
      date: '',
      showCourse: false,
      course: {
        name: '古筝课',
        teacher: '王月亮',
        time: '2019-09-16 9:00-10:00(am)'
      }
    }
  },
  methods: {
    getCourse (clazz) {
      console.log(clazz)
      // this.$router.push('/courseView')
      this.showCourse = true
    }
  },
  components: {
    calendar
  },
  created () {
    this.date = new Date().getFullYear() + '年' + (new Date().getMonth() + 1) + '月'
  }
}
</script>

<style scoped>
  .top-title{
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
  }
  .top-title .time{
    font-size: 22px;
    font-family: PingFang SC;
    font-weight: bold;
    line-height: 30px;
    color: rgba(30,30,30,1);
  }
</style>
